package com.hs.biye.controller.admin;

import com.hs.biye.constant.MessageConstant;
import com.hs.biye.excepction.BaseException;
import com.hs.biye.model.DTO.MedicineRequest;
import com.hs.biye.model.DTO.PagesRequest;
import com.hs.biye.model.DTO.RegistrationRequest;
import com.hs.biye.model.VO.MedicineVo;
import com.hs.biye.model.VO.RegistrationVo;
import com.hs.biye.model.reslut.Result;
import com.hs.biye.model.reslut.ResultPage;
import com.hs.biye.service.MedicineService;
import com.hs.biye.service.RegistrationService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/admin/registration")
public class RegistrationController {

    @Resource
    private RegistrationService registrationService;

    //查询挂号信息
    @PostMapping("/pages")
    public ResultPage<RegistrationVo> getRegistrationPage(@RequestBody RegistrationRequest request){
        if (request== null){
            throw new BaseException(MessageConstant.PAR_NOT_RIGHT);
        }
        return registrationService.getPage(request);
    }


    @GetMapping("/delete/{id}")
    public Result<Boolean> deleteRegistration(@PathVariable Integer id){
        if (id== null){
            throw new BaseException(MessageConstant.PAR_NOT_RIGHT);
        }
        Boolean b = registrationService.deleteRegistration(id);
        return Result.success(b);
    }
}
